<?php
/*
	Plugin Name: PhotoXhibit
	Plugin URI: http://benjaminsterling.com/photoxhibit/
	Description: Set up gallery widgets using Picasa / Flickr / Wordpress and jQuery <br/><br/> under development
	Author: Benjamin Sterling
	Version: 2.1.6
	Author URI: http://www.benjaminsterling.com
*/

error_reporting(E_ERROR | E_USER_ERROR);

if (!function_exists('add_action')) {
	//require_once('../../../wp-config.php');
} //  end : if (!function_exists('add_action'))

global $wpdb, $wp_version, $wpmu_version, $wp_roles;
global $px_view, $px_model, $px_controller, $phpSmug, $phpFlickr, $phpPicasa;

/**
 * check to see if the is wpmu
 */
$is_wpmu = version_compare($wpmu_version, '1.3', '>=');

/**
 * check to see if this is 2.5 or greater
 */
$is_25 = version_compare($wp_version, '2.4', '>=');


require_once('common/inc/model.php');
require_once('common/inc/view.php');
require_once('common/inc/controller.php');
require_once('common/inc/functions.php');
require_once('common/inc/encode.php');
require_once('common/inc/phpSmug.php');
require_once('common/inc/phpFlickr.php');

if( !function_exists('media_handle_upload') ){
	require_once(ABSPATH . 'wp-admin/includes/admin.php');
}

if(class_exists("px_controller")){

	// lets set up our classes
	$px_model 		= new px_model();
	$px_view 		= new px_view(__FILE__);
	$px_controller 	= new px_controller();
	$phpSmug 		= new phpSmug($px_model->smugmugapi, $px_model->appName.'/'.$px_model->appUrl);
	$phpFlickr 		= new phpFlickr($px_model->flickrapi, $px_model->flickrsecret);
	
	switch($_GET['option']){
		case 'getphpinfo':
			phpinfo();
			exit(0);
			break;
		case 'js':
			$px_view->print_js($_GET['js']);
			break;
	}

	add_action('init', 'px_init');
	add_filter('query_vars', 'px_setActions');
	add_action('template_redirect', 'px_doActions');
	add_filter('favorite_actions', 'px_favorite_actions');
	add_filter('media_upload_tabs', 'px_filter_media_upload_tabs');
	
	wp_enqueue_script('mediaHelper', $px_view->jsUri . 'mediaHelper.js', array('jquery')); 
	//add_action('setup_theme', 'px_doActions');
	
	
} // end : if(class_exists("px_controller"))


/*
$plugin_page
*/
?>